#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "CCParallaxNodeExtras.h"
#include "SimpleAudioEngine.h"


using namespace CocosDenshion ;

USING_NS_CC;

//输赢常量
typedef enum {
    KENDREASONWIN,
    KENDREASONLOSE
} EndReason;


class HelloWorld : public cocos2d::CCLayer
{
public:
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommand to return the exactly class pointer
    static cocos2d::CCScene* scene();
    
    // a selector callback
    void menuCloseCallback(CCObject* pSender);

    // implement the "static node()" method manually
    LAYER_CREATE_FUNC(HelloWorld);
    virtual void didAccelerate(CCAcceleration *pAccerlerationValue);

    float randomValueBetween(float low, float high);
    void setInvisible(CCNode *node);
    float getTimeTick();
    virtual void ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent *event);

   
private:
    CCParticleSystem *m_emitter;
    CCArray *_asteroids;
    //私有默认为0
    int _nextAsteroid;
    float _nextAsteroidSpawn;
    
    CCArray *_shipLasers;
    int _nextShipLaser;
    int _lives;
    
    CCSpriteBatchNode *_batchNode;
    CCSprite *_ship;
    
    CCParallaxNodeExtras *_backgroundNode;
    CCSprite *_spacedust1;
    CCSprite *_spacedust2;
    CCSprite *_planetsunrise;
    CCSprite *_galaxy;
    CCSprite *_spacialanomaly;
    CCSprite *_spacialanomaly2;
    void update(float dt);
    float _shipPointsPerSecY;
    
    double _gameOverTime ;
    bool _gameOver ;
    //输赢处理
    void endScene( EndReason endReason ) ;
    void restartTapped() ;
};

#endif // __HELLOWORLD_SCENE_H__
